package com.annotation.proxy.jdk.dynamicproxy;

import com.annotation.proxy.jdk.staticproxy.Hello;
import com.annotation.proxy.jdk.staticproxy.HelloInterface;

import java.lang.reflect.Proxy;

/**
 * @author: qiuli
 * @date: 2022/1/19 10:55
 * @description:
 */


public class DynamicProxyTest {
    public static void main(String[] args) {

        HelloInterface hello = new Hello();

        HelloInterface helloInterface = (HelloInterface) Proxy.newProxyInstance(hello.getClass().getClassLoader(), hello.getClass().getInterfaces(), new ProxyHandler(hello));
        helloInterface.sayHello();

    }
}
